﻿/*
 * File: TextureMaterial.cs
 * Author: Gourav Das
 * Purpose: Class for LightMaterial
 * Created: June 4 2011
 */

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace _22yards.ThreeD
{
    /// <summary>
    /// This is a game component that implements Material.
    /// </summary>
    public class TextureMaterial : CMaterial
    {
        public Texture2D ColorMapTexture { get; set; }
        public Texture2D NormalMapTexture { get; set; }
        public Texture2D SpecularMapTexture { get; set; }
        public Texture2D HeightMapTexture { get; set; }

        public TextureMaterial()
        {
            ColorMapTexture = null;
            NormalMapTexture = null;
            SpecularMapTexture = null;
            HeightMapTexture = null;
        }

        public override void SetEffectParameters(Effect effect)
        {
            if (effect.Parameters["ColorMapTexture"] != null && ColorMapTexture != null)
                effect.Parameters["ColorMapTexture"].SetValue(ColorMapTexture);
            if (effect.Parameters["NormalMapTexture"] != null && NormalMapTexture != null)
                effect.Parameters["NormalMapTexture"].SetValue(NormalMapTexture);
            if (effect.Parameters["SpecularMapTexture"] != null && SpecularMapTexture != null)
                effect.Parameters["SpecularMapTexture"].SetValue(SpecularMapTexture);
            if (effect.Parameters["HeightMapTexture"] != null && HeightMapTexture != null)
                effect.Parameters["HeightMapTexture"].SetValue(HeightMapTexture);
        }

    }
}
